package it.nard.utils;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class CopyFile {
	
	public static void copy(InputStream finput, File outputFile){
		try{
//			File inputFile = new File("nome_oroginale");
//			File outputFile = new File("nuovo_file");
//			InputStream finput = new BufferedInputStream(new FileInputStream(inputFile));
			OutputStream foutput = new BufferedOutputStream( new FileOutputStream(outputFile));
			byte[] buffer = new byte[1024 * 500];
			int bytes_letti = 0;
			while((bytes_letti = finput.read(buffer)) > 0)
			foutput.write(buffer, 0, bytes_letti);
			finput.close();
			foutput.close();
		}catch(Exception e){
			
		}
	}
}

